JIT: fix RBO constant relop truth evaluation under opt-repeat#129487
Closed
Copilot wants to merge 2 commits into
Closed
JIT: fix RBO constant relop truth evaluation under opt-repeat#129487Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Co-authored-by: JulieLeeMSFT <63486087+JulieLeeMSFT@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix silent miscompile causing divide-by-zero in JIT stress optimization
JIT: fix RBO constant relop truth evaluation under opt-repeat
Jun 17, 2026
Member
|
I wonder if the bug is actually elsewhere? How do we end up with a relop VN that is not TYP_INT? |
Member
|
The relop is: EQ( AND( V04, ADD(V09, -0xcba13) ), 0 )
The relop VN is a legitimately-computed TYP_INT constant 1 — derived from V04 being wrongly value-numbered as constant 0. That's the real bug, and it's upstream of RBO. Trying a different fix. |
Member
|
@copilot, this PR does not fix the issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under
STRESS_OPT_REPEAT/JitOptRepeat, a second optimization iteration could mis-evaluate a constant relop and steer control flow down the wrong branch, reaching an unreachable% 0path. This change makes redundant-branch optimization type-correct when interpreting constant value numbers and adds a focused regression covering the reported repro shape.JIT fix (RBO constant-VN handling)
src/coreclr/jit/redundantbranchopts.cppto compare constant relop VNs against a zero VN of the actual VN type instead of hardcodingTYP_INT.Regression coverage
src/tests/JIT/Regression/JitBlue/Runtime_129386/Runtime_129386.cs.src/tests/JIT/Regression/JitBlue/Runtime_129386/Runtime_129386.csprojwithJitEnableOptRepeat=1,JitOptRepeat=Fn30000002142, andJitOptRepeatCount=2.DivideByZeroExceptionpath).